package com.zlx.xbhy.controller;

import com.zlx.xbhy.entity.Result;
import com.zlx.xbhy.service.DeptServeice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName DeptController
 * @Description TODO
 * @Author Edward
 * @Date 2020/11/19 20:36
 */
@RestController
@RequestMapping("dept")
public class DeptController {
    @Autowired
    private DeptServeice deptServeice;

    @GetMapping("selectAllUsedDept")
    public Result selectAllUsedDept(){
        return new Result(deptServeice.listDept());
    }

    @GetMapping("getById/{id}")
    public Result getById(@PathVariable Long id){
        return new Result(deptServeice.selectByPrimaryKey(id));
    }

    @GetMapping("selectAll")
    public Result selectAll(){
        return new Result(deptServeice.selectAll());
    }
}
